package ybt.repository;

import java.util.List;

import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import ybt.custom.BaseRepository;
import ybt.entity.Course;
import ybt.entity.Grade;

@Repository
public interface GradeRepository extends BaseRepository<Grade, Integer>{

	public List<Grade> findByStudentId(Integer id);

	public Grade findByStudentIdAndCourseId(Integer id, Integer kcId);

	public List<Grade> findByStudent_TbClass_IdAndCourseId(Integer bjid, Integer kcid);
	
	@Query(value ="select distinct t.course from Grade t where t.student.tbClass.id=?1"  )
	public List<Course> findCourseByTbClassId(Integer bjId); 
	 @Query(value ="from Grade g where g.student.tbClass.id=?1 and g.student.id=?2") 
		public List<Grade> findByTbClassIdAndStudnetId(Integer bjId, Integer stuId);
}
